package cn.billy.feign;

import cn.billy.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeign> {
    @Override
    public UserFeign create(Throwable throwable) {
        return new UserFeign() {
            @Override
            public User getById(Long id) {
//                throwable.printStackTrace();
                return User.builder().id(-1l).name("此服务器繁忙").build();
            }
        };
    }
}
